<template>
  <div class="StaffSeconded">
    <div class="Title">
      <div class="blue"></div>
      <span class="title">人员借调</span>
      <el-button
        class="right-box"
        type="info"
        icon="el-icon-back"
        onclick="window.history.go(-1)"
      >返回</el-button>
    </div>
    <div class="staffSeconded">
      <div class="staff_up">
        <p class="staff_jd" @click="SecondedSq">借调申请</p>
      </div>
      <div class="staff_down">
        <el-table :data="tableData" :max-height="400" stripe>
          <el-table-column prop="applyforon" label="申请日期" align="center"></el-table-column>
          <el-table-column prop="empnolist" label="员工借调姓名" align="center" show-overflow-tooltip></el-table-column>
          <el-table-column prop="state" label="状态" align="center"></el-table-column>
          <el-table-column prop label="操作" align="center">
            <template slot-scope="scope">
              <el-button size="small" type="warning" @click="Shenhe(scope.row.room,scope.row.applyforon)">审核</el-button>
              <el-button
                type="primary"
                @click="xiangq(scope.row.room,scope.row.applyforon)"
                size="small"
              >详情</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="empphone_Btn">
        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item>
            <el-button type="primary">确认</el-button>
            <el-button type="info" onclick="window.history.go(-1)">返回</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>
<script>
import axios from "axios";
export default {
  data() {
    return {
      tableData: [
        {
          text: "1"
        }
      ],
      form: {}
    };
  },
  created() {
    this.getlist();
  },
  methods: {
    Shenhe(room, applyforon) {
      this.$router.push({
        path: "./EmployeeShenhe",
        query: { prod: room, row: applyforon }
      });
    },
    xiangq(room, applyforon) {
      this.$router.push({
        path: "./EmployeeXiangq",
        query: { prod: room, row: applyforon }
      });
    },
    SecondedSq() {
      this.$router.push("/SecondedShenq");
    },
    getlist() {
      var obj = {
        start: "",
        end: "",
        pn: 0,
        PerPageSize: 10000
      };
      var objs = JSON.stringify(obj);
      axios(
        "/apis/ProductionManagement.asmx/List?index=30&jsondata=" + objs
      ).then(({ data }) => {
        var datas = this.$x2js.xml2js(data);
        console.log(data);
        var list = JSON.parse(datas.string.__text);
        console.log("list");
        console.log(list);
        this.tableData = list;
        for (var i = 0; i < list.length; i++) {
          var dd = new Date(parseInt(list[i].applyforon.substr(6, 13)));
          var y = dd.getFullYear();
          var m = dd.getMonth() + 1;
          m = m < 10 ? "0" + m : m;
          var d = dd.getDate();
          d = d < 10 ? "0" + d : d;
          list[i].applyforon = y + "-" + m + "-" + d + " ";
          // list[i].xuhao = 1 + i + 10 * page;
        }
      });
    }
  },
  components: {}
};
</script>

<style lang="scss" scoped>
@import "@/assets/scss/base.scss";
.StaffSeconded {
  width: 99%;
  height: 700px;
  //   border: 1px solid red;
}
.Title {
  width: 99%;
  height: 35px;
  margin-top: 10px;
}
.blue {
  width: 5px;
  height: 20px;
  background-color: $Header_color;
  margin-left: 20px;
  margin-top: 5px;
  float: left;
}
.title {
  margin-left: 10px;
  line-height: 35px;
}
.staffSeconded {
  width: 99%;
  height: 700px;
  background-color: $white;
  border: 1px solid $linecolor;
  margin-left: 15px;
  margin-top: 10px;
}
.staff_up {
  width: 99%;
  height: 130px;
  //   border: 1px solid #000;
}
.staff_jd {
  width: 100px;
  height: 100px;
  float: right;
  border-radius: 10px;
  border: 3px solid #0962a7;
  font-size: 16px;
  line-height: 100px;
  text-align: center;
  color: #0962a7;
  margin-top: 15px;
  margin-right: 30px;
  cursor: pointer;
}
.staff_down {
  width: 95%;
  height: 400px;
  border: 1px solid $linecolor;
  // border: 1px solid #000;
  margin: 0 auto;
}
.empphone_Btn {
  width: 99%;
  height: 100px;
  margin-top: 30px;
  text-align: center;
  // border: 1px solid #000;
}
.right-box {
  float: right;
  margin-right: 2%;
  border-radius: 5px;
}
</style>
